// 根路径 -> craco.config.js
const CracoLessPlugin = require("craco-less");
const path = require('path')
const resolve = dir => path.resolve(__dirname, dir)

module.exports = {
    webpack: {
        alias: {
            '@': path.resolve(__dirname, 'src'),
            '@components': path.resolve(__dirname, 'src/components'),
            '@assets': path.resolve(__dirname, 'src/assets'),
            '@router': path.resolve(__dirname, 'src/router'),
            '@store': path.resolve(__dirname, 'src/store'),
            '@utils': path.resolve(__dirname, 'src/utils'),
            '@pages': path.resolve(__dirname, 'src/views'),
            '@api': path.resolve(__dirname, 'src/api'),
        },

        // configure: (webpackConfig, { env, paths }) => {
        //     webpackConfig.output.path = path.resolve(__dirname, "dist")//ts和less编译后的文件
        //     paths.appBuild = path.resolve(__dirname, "dist");//public中的文件
        //     return webpackConfig;
        // }
    },
    plugins: [
        {
            plugin: CracoLessPlugin,
            options: {
                lessLoaderOptions: {
                    lessOptions: {
                        //颜色即为自定义颜色
                        modifyVars: {'@primary-color': 'rgba(252,152,255,0.78)'},
                        javascriptEnabled: true,
                    },
                },
            },
        }
    ],
}
